//  this library.
import 'package:hktk_app/ienum/subject/collection_type_enum.dart';

/// 我的笔记试卷/章节相关模型
class NoteChapterModel {
  String? relationName;
  String? relationId;
  CollectionTypeEnum? type;
  int? noteNum;
  dynamic label;
  String? parentId;
  String? id;
  dynamic children;

  NoteChapterModel({
    this.relationName,
    this.relationId,
    this.type,
    this.noteNum,
    this.label,
    this.parentId,
    this.id,
    this.children,
  });

  NoteChapterModel.fromJson(Map<String, dynamic> json) {
    relationName = json['relationName'];
    relationId = json['relationId'];
    if (json["type"] != null) {
      type = CollectionTypeEnum.getTypeEnum(json['type']);
    }
    noteNum = json['noteNum'];
    label = json['label'];
    parentId = json['parentId'];
    id = json['id'];
    children = json['children'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['relationName'] = relationName;
    data['relationId'] = relationId;
    if (type != null) {
      data['type'] = type!.name;
    }
    data['noteNum'] = noteNum;
    data['label'] = label;
    data['parentId'] = parentId;
    data['id'] = id;
    data['children'] = children;
    return data;
  }
}
